package com.inspur.jzsxxzx.service.catalog.impl;

import com.inspur.jzsxxzx.entity.catalog.DataBasicElemCatalog;
import com.inspur.jzsxxzx.mapper.catalog.DataBasicElemCatalogMapper;
import com.inspur.jzsxxzx.service.catalog.DataBasicElemCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DataBasicElemCatalogServiceImpl implements DataBasicElemCatalogService {
    
    @Autowired
    private DataBasicElemCatalogMapper dataBasicElemCatalogMapper;
    
    @Override
    public int save(DataBasicElemCatalog record) {
        return dataBasicElemCatalogMapper.insert(record);
    }
    
    @Override
    public DataBasicElemCatalog findById(String cataId, Integer version) {
        return dataBasicElemCatalogMapper.selectByPrimaryKey(cataId, version);
    }
    
    @Override
    public int update(DataBasicElemCatalog record) {
        return dataBasicElemCatalogMapper.updateByPrimaryKey(record);
    }
    
    @Override
    public int deleteById(String cataId, Integer version) {
        return dataBasicElemCatalogMapper.deleteByPrimaryKey(cataId, version);
    }
    
    @Override
    public List<DataBasicElemCatalog> findAll() {
        return dataBasicElemCatalogMapper.selectAll();
    }
    
    @Override
    public List<DataBasicElemCatalog> findByCondition(DataBasicElemCatalog condition) {
        return dataBasicElemCatalogMapper.selectByCondition(condition);
    }
    
    @Override
    public List<DataBasicElemCatalog> findByPage(DataBasicElemCatalog condition, int pageNum, int pageSize) {
        int offset = (pageNum - 1) * pageSize;
        return dataBasicElemCatalogMapper.selectByPage(condition, offset, pageSize);
    }
    
    @Override
    public int countByCondition(DataBasicElemCatalog condition) {
        return dataBasicElemCatalogMapper.countByCondition(condition);
    }
}